package com.gzy.rpsm_property.utils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class GenderValidator implements ConstraintValidator<ValidGender, Integer> {

    @Override
    public void initialize(ValidGender constraintAnnotation) {}

    @Override
    public boolean isValid(Integer gender, ConstraintValidatorContext context) {
        return gender != null && (gender == 1 || gender == 2);
    }
}